home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 December / PCWDEC06.iso / Software / Freeware / Partition Logic 0.63 / partlogic-0.63.iso / system / headers / sys / device.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-08-22  |  4.4 KB  |  127 lines

  1. // 
  2. //  Visopsys
  3. //  Copyright (C) 1998-2006 J. Andrew McLaughlin
  4. //  
  5. //  This library is free software; you can redistribute it and/or modify it
  6. //  under the terms of the GNU Lesser General Public License as published by
  7. //  the Free Software Foundation; either version 2.1 of the License, or (at
  8. //  your option) any later version.
  9. //
  10. //  This library is distributed in the hope that it will be useful, but
  11. //  WITHOUT ANY WARRANTY; without even the implied warranty of
  12. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
  13. //  General Public License for more details.
  14. //
  15. //  You should have received a copy of the GNU Lesser General Public License
  16. //  along with this library; if not, write to the Free Software Foundation,
  17. //  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. //
  19. //  device.h
  20. //
  21.  
  22. // This file contains definitions and structures for using Visopsys hardware
  23. // devices
  24.  
  25. #if !defined(_DEVICE_H)
  26.  
  27. #include <sys/variable.h>
  28.  
  29. #define DEV_CLASSNAME_MAX                   32
  30.  
  31. // Hardware device classes and subclasses
  32. #define DEVICECLASS_NONE                    0
  33. #define DEVICECLASS_SYSTEM                  0x0100
  34. #define DEVICECLASS_CPU                     0x0200
  35. #define DEVICECLASS_MEMORY                  0x0300
  36. #define DEVICECLASS_BUS                     0x0400
  37. #define DEVICECLASS_PIC                     0x0500
  38. #define DEVICECLASS_SYSTIMER                0x0600
  39. #define DEVICECLASS_RTC                     0x0700
  40. #define DEVICECLASS_DMA                     0x0800
  41. #define DEVICECLASS_KEYBOARD                0x0900
  42. #define DEVICECLASS_MOUSE                   0x0A00
  43. #define DEVICECLASS_DISK                    0x0B00
  44. #define DEVICECLASS_GRAPHIC                 0x0C00
  45. #define DEVICECLASS_NETWORK                 0x0D00
  46. #define DEVICECLASS_HUB                     0x0E00
  47. #define DEVICECLASS_STORAGE                 0x0F00
  48. #define DEVICECLASS_UNKNOWN                 0xFFFF
  49.  
  50. // Device sub-classes
  51.  
  52. #define DEVICESUBCLASS_NONE                 0
  53. #define DEVICESUBCLASS_UNKNOWN              (DEVICECLASS_UNKNOWN | 0x01)
  54.  
  55. // System device subclasses                 
  56. #define DEVICESUBCLASS_SYSTEM_BIOS          (DEVICECLASS_SYSTEM | 0x01)
  57.  
  58. // Sub-classes of CPUs
  59. #define DEVICESUBCLASS_CPU_X86              (DEVICECLASS_CPU | 0x01)
  60.  
  61. // Sub-classes of buses
  62. #define DEVICESUBCLASS_BUS_PCI              (DEVICECLASS_BUS | 0x01)
  63. #define DEVICESUBCLASS_BUS_USB              (DEVICECLASS_BUS | 0x02)
  64.  
  65. // Sub-classes of keyboards
  66. #define DEVICESUBCLASS_KEYBOARD_USB         (DEVICECLASS_KEYBOARD | 0x01)
  67.  
  68. // Sub-classes of mice
  69. #define DEVICESUBCLASS_MOUSE_PS2            (DEVICECLASS_MOUSE | 0x01)
  70. #define DEVICESUBCLASS_MOUSE_SERIAL         (DEVICECLASS_MOUSE | 0x02)
  71. #define DEVICESUBCLASS_MOUSE_USB            (DEVICECLASS_MOUSE | 0x03)
  72.  
  73. // Sub-classes of disks
  74. #define DEVICESUBCLASS_DISK_FLOPPY          (DEVICECLASS_DISK | 0x01)
  75. #define DEVICESUBCLASS_DISK_IDE             (DEVICECLASS_DISK | 0x02)
  76. #define DEVICESUBCLASS_DISK_SCSI            (DEVICECLASS_DISK | 0x03)
  77. #define DEVICESUBCLASS_DISK_CDDVD           (DEVICECLASS_DISK | 0x04)
  78.  
  79. // Sub-classes of graphics adapters
  80. #define DEVICESUBCLASS_GRAPHIC_FRAMEBUFFER  (DEVICECLASS_GRAPHIC | 0x01)
  81.  
  82. // Sub-classes of network adapters
  83. #define DEVICESUBCLASS_NETWORK_ETHERNET     (DEVICECLASS_NETWORK | 0x01)
  84.  
  85. // Sub-classes of hubs
  86. #define DEVICESUBCLASS_HUB_USB              (DEVICECLASS_HUB | 0x01)
  87.  
  88. // Sub-classes of storage
  89. #define DEVICESUBCLASS_STORAGE_FLASH        (DEVICECLASS_STORAGE | 0x01)
  90. #define DEVICESUBCLASS_STORAGE_TAPE         (DEVICECLASS_STORAGE | 0x02)
  91.  
  92. // For masking off class/subclass
  93. #define DEVICECLASS_MASK                    0xFF00
  94. #define DEVICESUBCLASS_MASK                 0x00FF
  95.  
  96. // A list of standard device attribute names
  97. #define DEVICEATTRNAME_VENDOR               "vendor.name"
  98. #define DEVICEATTRNAME_MODEL                "model.name"
  99.  
  100. // A structure for device classes and subclasses, which just allows us to
  101. // associate the different types with string names.
  102. typedef struct {
  103.   int class;
  104.   char name[DEV_CLASSNAME_MAX];
  105.  
  106. } deviceClass;
  107.  
  108. // The generic hardware device structure
  109. typedef struct {
  110.   // Device class and subclass.  Subclass optional.
  111.   deviceClass class;
  112.   deviceClass subClass;
  113.  
  114.   // Optional list of text attributes
  115.   variableList attrs;
  116.  
  117.   // Used for maintaining the list of devices as a tree
  118.   void *parent;
  119.   void *firstChild;
  120.   void *previous;
  121.   void *next;
  122.  
  123. } device;
  124.  
  125. #define _DEVICE_H
  126. #endif
  127.